<%@ Control Language="C#" AutoEventWireup="true" CodeFile="privatemessages.ascx.cs" Inherits="forums_controls_usercp_pm_privatemessages" %>
<%@ Register Src="newmessage.ascx" TagName="newmessage" TagPrefix="uc2" %>
<%@ Register Src="viewPM.ascx" TagName="viewPM" TagPrefix="uc3" %>
<%@ Register Src="../../misc/Pager.ascx" TagName="Pager" TagPrefix="uc1" %>
<asp:MultiView ID="mviewPMs" runat="server">
    <asp:View ID="viewMsgs" runat="server">
        <p>
            <asp:Label runat="server" ID="lblMailbox" Text="Inbox" />
        </p>
        <asp:Repeater runat="server" ID="rptPages">
            <HeaderTemplate>
                <p>Page
            </HeaderTemplate>
            <ItemTemplate>
                <asp:LinkButton runat="server" ID="btnPage"
                    CommandArgument='<%# Eval("ItemText") %>'
                    Text='<%# Eval("ItemText") %>'
                    Font-Bold='<%# Eval("IsCurrentPage") %>'
                    OnCommand="SwitchPage"/>
            </ItemTemplate>
            <FooterTemplate>
                </p>
            </FooterTemplate>
        </asp:Repeater>
        <asp:GridView runat="server" ID="gridMsgs" Width="100%" AutoGenerateColumns="False" GridLines="None">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Image runat="server" ID="imgNew"
                            ImageAlign="left"
                            Visible='<%# !Convert.ToBoolean(Eval("MsgRead")) %>'
                            ImageUrl="~/forums/images/mail_new.gif" />
                        <asp:LinkButton runat="server" ID="btnSubject"
                            Text='<%# Helpers.StringHelper.SafeFormat(Eval("Subject")) %>'
                            CommandArgument='<%# Eval("ID") %>'
                            OnCommand="ShowMessage"/><br />
                    </ItemTemplate>
                    <HeaderTemplate>
                        Subject
                    </HeaderTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:HyperLink runat="server" ID="lnkProfile"
                            Text='<%# Helpers.StringHelper.SafeFormat(Eval("From.Username")) %>'
                            NavigateUrl='<%# Helpers.StringHelper.SafeFormat("~/forums/profile.aspx?u={0}", Eval("From.ID")) %>'/>
                    </ItemTemplate>
                    <HeaderTemplate>
                        Sender
                    </HeaderTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <%# ((DateTime)Eval("DateSent")).ToString("yyyy-MMM-dd hh:mm tt") %>
                    </ItemTemplate>
                    <HeaderTemplate>
                        Date
                    </HeaderTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:HiddenField runat="server" ID="lblID"
                            Value='<%# Eval("ID") %>' />
                        <asp:CheckBox runat="server" ID="chkDelete"
                            />
                    </ItemTemplate>
                    <HeaderTemplate>
                        Delete
                    </HeaderTemplate>
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                No messages.
            </EmptyDataTemplate>
        </asp:GridView>
        <div align="right">
            <asp:Button runat="server" ID="btnDeleteAll"
                Text="Delete All" OnClick="btnDeleteAll_Click" />
            <asp:Button runat="server" ID="btnDeleteSelected"
                Text="Delete Selected" OnClick="btnDeleteSelected_Click" />
        </div>
    </asp:View>
    <asp:View ID="viewError" runat="server">
        Oops!</asp:View>
    <asp:View ID="viewNew" runat="server">
        <uc2:newmessage ID="Newmessage1" runat="server"
            OnMessageCreated="MessageCreated" />
    </asp:View>
    <asp:View ID="viewMessage" runat="server">
        <uc3:viewPM ID="ViewPM1" runat="server"
            OnReply="NewReply"
            OnQuote="NewQuote"/>
    </asp:View>
</asp:MultiView>
